import java.util.Observable;

import javax.sound.midi.ControllerEventListener;
import javax.sound.midi.ShortMessage;


public class PlayerObservable extends Observable implements IPlayer, ControllerEventListener {
	private static final long serialVersionUID = 1L;
	private IPlayer decoratedPlayer;
	
	public PlayerObservable() {
		super();
		decoratedPlayer = new Player();
		this.addListener(this); // ...
	}

	@Override
	public void controlChange(ShortMessage event) {
		setChanged();
		notifyObservers();
	}

	@Override
	public void start() {
		decoratedPlayer.start();
	}

	@Override
	public void stop() {
		decoratedPlayer.stop();
	}

	@Override
	public void load(String userChoice) {
		decoratedPlayer.load(userChoice);
	}

	@Override
	public void addListener(ControllerEventListener listener) {
		decoratedPlayer.addListener(listener);
	}
}
